{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "c66b5d61",
   "metadata": {},
   "source": [
    "##  1. 搜索POI的使用以及调用api到小程序的实践"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "54c8fde9",
   "metadata": {},
   "source": [
    "## 2. 搜索POI\n",
    "> 1. 关键词\n",
    "> 2. 分类（type）规范（poi编码表）"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 41,
   "id": "657c141e",
   "metadata": {},
   "outputs": [],
   "source": [
    "# 接口调用模块\n",
    "# 1. 调用requests模块（谷歌浏览器）\n",
    "import requests\n",
    "\n",
    "# 2.请求方法：Get\n",
    "\n",
    "# 3.url地址：\n",
    "t_url = \"https://restapi.amap.com/v3/geocode/regeo?parameters\"\n",
    "\n",
    "# 4.准备参数，用于交换数据[payload]\n",
    "payload = {\n",
    "    'key' : 'a100a0fe3fbe830ec11430470e8809b0',\n",
    "    'location' : '113.671505,23.643685',\n",
    "    'extensions':'all',\n",
    "    'poitype':'all'\n",
    "}\n",
    "\n",
    "# 5. 发起请求 酬载\n",
    "# params --> 请求的参数\n",
    "r = requests.get(url=t_url,params=payload)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 42,
   "id": "a3d21424",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'status': '1',\n",
       " 'info': 'OK',\n",
       " 'infocode': '10000',\n",
       " 'regeocode': {'formatted_address': '广东省广州市从化区温泉镇温泉大道882号',\n",
       "  'addressComponent': {'country': '中国',\n",
       "   'province': '广东省',\n",
       "   'city': '广州市',\n",
       "   'citycode': '020',\n",
       "   'district': '从化区',\n",
       "   'adcode': '440117',\n",
       "   'township': '温泉镇',\n",
       "   'towncode': '440117100000',\n",
       "   'neighborhood': {'name': [], 'type': []},\n",
       "   'building': {'name': [], 'type': []},\n",
       "   'streetNumber': {'street': '温泉大道',\n",
       "    'number': '882号',\n",
       "    'location': '113.671505,23.643685',\n",
       "    'direction': 'Center',\n",
       "    'distance': '0'},\n",
       "   'businessAreas': [{'location': '113.648930,23.636205',\n",
       "     'name': '温泉',\n",
       "     'id': '440117'}]},\n",
       "  'pois': [{'id': 'B0I6BUT5PX',\n",
       "    'name': '顺通驾校',\n",
       "    'type': '科教文化服务;驾校;驾校',\n",
       "    'tel': [],\n",
       "    'direction': '东',\n",
       "    'distance': '229.992',\n",
       "    'location': '113.673591,23.644476',\n",
       "    'address': '温泉大道888号',\n",
       "    'poiweight': '0.183876',\n",
       "    'businessarea': '温泉'},\n",
       "   {'id': 'B0FFIXZM0P',\n",
       "    'name': '从化温泉竹园农庄(温泉镇店)',\n",
       "    'type': '餐饮服务;中餐厅;中餐厅',\n",
       "    'tel': '13650895671',\n",
       "    'direction': '东北',\n",
       "    'distance': '226.766',\n",
       "    'location': '113.672914,23.645264',\n",
       "    'address': '温泉镇卫东村105国道旁广州南方学院斜对面',\n",
       "    'poiweight': '0.205309',\n",
       "    'businessarea': '温泉'},\n",
       "   {'id': 'B0FFG6A3H6',\n",
       "    'name': '中石油冠力金叶加油站',\n",
       "    'type': '汽车服务;加油站;中国石油',\n",
       "    'tel': '020-87830698',\n",
       "    'direction': '东北',\n",
       "    'distance': '273.921',\n",
       "    'location': '113.673866,23.644864',\n",
       "    'address': '温泉大道888号',\n",
       "    'poiweight': '0.55295',\n",
       "    'businessarea': '温泉'},\n",
       "   {'id': 'B0FFFAIYUL',\n",
       "    'name': '悠然居农庄',\n",
       "    'type': '体育休闲服务;休闲场所;休闲场所',\n",
       "    'tel': '020-87836333',\n",
       "    'direction': '东北',\n",
       "    'distance': '453.658',\n",
       "    'location': '113.674596,23.646622',\n",
       "    'address': '温泉镇卫东村105国道旁(中石油油站斜对面)',\n",
       "    'poiweight': '0.176098',\n",
       "    'businessarea': '温泉'},\n",
       "   {'id': 'B00141JCE0',\n",
       "    'name': '卫东村委会',\n",
       "    'type': '政府机构及社会团体;政府机关;乡镇以下级政府及事业单位',\n",
       "    'tel': [],\n",
       "    'direction': '东北',\n",
       "    'distance': '783.685',\n",
       "    'location': '113.677684,23.647884',\n",
       "    'address': '温泉大道与三层街交叉口东北约160米',\n",
       "    'poiweight': '0.0982661',\n",
       "    'businessarea': '温泉'},\n",
       "   {'id': 'B00141JCP2',\n",
       "    'name': '中共卫东村支部委员会',\n",
       "    'type': '政府机构及社会团体;政府机关;乡镇以下级政府及事业单位',\n",
       "    'tel': [],\n",
       "    'direction': '东北',\n",
       "    'distance': '791.834',\n",
       "    'location': '113.677733,23.647946',\n",
       "    'address': '温泉大道与三层街交叉路口往东北约180米',\n",
       "    'poiweight': '0.123706',\n",
       "    'businessarea': '温泉'},\n",
       "   {'id': 'B0FFLJUBM6',\n",
       "    'name': '浩锋拖车服务有限公司',\n",
       "    'type': '汽车服务;汽车服务相关;汽车服务相关',\n",
       "    'tel': [],\n",
       "    'direction': '西',\n",
       "    'distance': '464.566',\n",
       "    'location': '113.666989,23.643103',\n",
       "    'address': '温泉镇福泉路荔品汇方向上坡往前走400米',\n",
       "    'poiweight': '0.172207',\n",
       "    'businessarea': '温泉'},\n",
       "   {'id': 'B0FFLJV8JY',\n",
       "    'name': '从化公安24小时自助办证区',\n",
       "    'type': '政府机构及社会团体;公检法机构;公安警察',\n",
       "    'tel': [],\n",
       "    'direction': '西',\n",
       "    'distance': '577.938',\n",
       "    'location': '113.665957,23.642598',\n",
       "    'address': [],\n",
       "    'poiweight': '0.266754',\n",
       "    'businessarea': '温泉'},\n",
       "   {'id': 'B00140SSJ8',\n",
       "    'name': '其兴里',\n",
       "    'type': '地名地址信息;普通地名;村庄级地名',\n",
       "    'tel': [],\n",
       "    'direction': '东北',\n",
       "    'distance': '670.899',\n",
       "    'location': '113.674968,23.648817',\n",
       "    'address': '从化区',\n",
       "    'poiweight': '0.300883',\n",
       "    'businessarea': '温泉'},\n",
       "   {'id': 'B00140SSJT',\n",
       "    'name': '卫东村',\n",
       "    'type': '地名地址信息;普通地名;村庄级地名',\n",
       "    'tel': [],\n",
       "    'direction': '东北',\n",
       "    'distance': '791.834',\n",
       "    'location': '113.677733,23.647946',\n",
       "    'address': '从化区',\n",
       "    'poiweight': '0.281402',\n",
       "    'businessarea': '温泉'},\n",
       "   {'id': 'B0FFHI5E3D',\n",
       "    'name': '卫东立交',\n",
       "    'type': '地名地址信息;交通地名;立交桥',\n",
       "    'tel': [],\n",
       "    'direction': '西北',\n",
       "    'distance': '697.827',\n",
       "    'location': '113.665349,23.646438',\n",
       "    'address': '从化区',\n",
       "    'poiweight': '0.243363',\n",
       "    'businessarea': '温泉'},\n",
       "   {'id': 'B0FFL3TNAX',\n",
       "    'name': '从化消防大队温泉站',\n",
       "    'type': '政府机构及社会团体;公检法机构;消防机关',\n",
       "    'tel': [],\n",
       "    'direction': '东北',\n",
       "    'distance': '716.362',\n",
       "    'location': '113.677249,23.647402',\n",
       "    'address': '温泉大道与三层街交叉口东北约100米',\n",
       "    'poiweight': '0.145199',\n",
       "    'businessarea': '温泉'},\n",
       "   {'id': 'B0FFIAPQ5C',\n",
       "    'name': '荔品汇(建设中)',\n",
       "    'type': '商务住宅;商务住宅相关;商务住宅相关',\n",
       "    'tel': [],\n",
       "    'direction': '西',\n",
       "    'distance': '899.214',\n",
       "    'location': '113.662855,23.642072',\n",
       "    'address': 'Y526(福泉路)',\n",
       "    'poiweight': '0.163558',\n",
       "    'businessarea': '温泉'},\n",
       "   {'id': 'B0FFGSLPVS',\n",
       "    'name': '温泉出口(G45大广高速南向)',\n",
       "    'type': '地名地址信息;交通地名;高速路出口',\n",
       "    'tel': [],\n",
       "    'direction': '西南',\n",
       "    'distance': '992.802',\n",
       "    'location': '113.664404,23.637570',\n",
       "    'address': '从化区',\n",
       "    'poiweight': '0.209425',\n",
       "    'businessarea': '温泉'},\n",
       "   {'id': 'B0FFGSLOPD',\n",
       "    'name': '温泉收费站(G45大广高速入口)',\n",
       "    'type': '道路附属设施;收费站;收费站',\n",
       "    'tel': [],\n",
       "    'direction': '西南',\n",
       "    'distance': '840.769',\n",
       "    'location': '113.666065,23.637999',\n",
       "    'address': '从化区',\n",
       "    'poiweight': '0.186236',\n",
       "    'businessarea': '温泉'}],\n",
       "  'roads': [{'id': '020F49F0050462451',\n",
       "    'name': '中山路',\n",
       "    'direction': '西南',\n",
       "    'distance': '21.7638',\n",
       "    'location': '113.672,23.6438'},\n",
       "   {'id': '020F49F00504698',\n",
       "    'name': '温泉大道',\n",
       "    'direction': '东南',\n",
       "    'distance': '38.8638',\n",
       "    'location': '113.671,23.644'},\n",
       "   {'id': '020F49F006047765',\n",
       "    'name': 'S29从莞深高速',\n",
       "    'direction': '北',\n",
       "    'distance': '97.7893',\n",
       "    'location': '113.671,23.6428'}],\n",
       "  'roadinters': [{'direction': '南',\n",
       "    'distance': '41.2308',\n",
       "    'location': '113.671429,23.644049',\n",
       "    'first_id': '020F49F0050462451',\n",
       "    'first_name': '中山路',\n",
       "    'second_id': '020F49F00504698',\n",
       "    'second_name': '温泉大道'}],\n",
       "  'aois': []}}"
      ]
     },
     "execution_count": 42,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "r.json()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 43,
   "id": "09683b3a",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[{'id': 'B0I6BUT5PX',\n",
       "  'name': '顺通驾校',\n",
       "  'type': '科教文化服务;驾校;驾校',\n",
       "  'tel': [],\n",
       "  'direction': '东',\n",
       "  'distance': '229.992',\n",
       "  'location': '113.673591,23.644476',\n",
       "  'address': '温泉大道888号',\n",
       "  'poiweight': '0.183876',\n",
       "  'businessarea': '温泉'},\n",
       " {'id': 'B0FFIXZM0P',\n",
       "  'name': '从化温泉竹园农庄(温泉镇店)',\n",
       "  'type': '餐饮服务;中餐厅;中餐厅',\n",
       "  'tel': '13650895671',\n",
       "  'direction': '东北',\n",
       "  'distance': '226.766',\n",
       "  'location': '113.672914,23.645264',\n",
       "  'address': '温泉镇卫东村105国道旁广州南方学院斜对面',\n",
       "  'poiweight': '0.205309',\n",
       "  'businessarea': '温泉'},\n",
       " {'id': 'B0FFG6A3H6',\n",
       "  'name': '中石油冠力金叶加油站',\n",
       "  'type': '汽车服务;加油站;中国石油',\n",
       "  'tel': '020-87830698',\n",
       "  'direction': '东北',\n",
       "  'distance': '273.921',\n",
       "  'location': '113.673866,23.644864',\n",
       "  'address': '温泉大道888号',\n",
       "  'poiweight': '0.55295',\n",
       "  'businessarea': '温泉'},\n",
       " {'id': 'B0FFFAIYUL',\n",
       "  'name': '悠然居农庄',\n",
       "  'type': '体育休闲服务;休闲场所;休闲场所',\n",
       "  'tel': '020-87836333',\n",
       "  'direction': '东北',\n",
       "  'distance': '453.658',\n",
       "  'location': '113.674596,23.646622',\n",
       "  'address': '温泉镇卫东村105国道旁(中石油油站斜对面)',\n",
       "  'poiweight': '0.176098',\n",
       "  'businessarea': '温泉'},\n",
       " {'id': 'B00141JCE0',\n",
       "  'name': '卫东村委会',\n",
       "  'type': '政府机构及社会团体;政府机关;乡镇以下级政府及事业单位',\n",
       "  'tel': [],\n",
       "  'direction': '东北',\n",
       "  'distance': '783.685',\n",
       "  'location': '113.677684,23.647884',\n",
       "  'address': '温泉大道与三层街交叉口东北约160米',\n",
       "  'poiweight': '0.0982661',\n",
       "  'businessarea': '温泉'},\n",
       " {'id': 'B00141JCP2',\n",
       "  'name': '中共卫东村支部委员会',\n",
       "  'type': '政府机构及社会团体;政府机关;乡镇以下级政府及事业单位',\n",
       "  'tel': [],\n",
       "  'direction': '东北',\n",
       "  'distance': '791.834',\n",
       "  'location': '113.677733,23.647946',\n",
       "  'address': '温泉大道与三层街交叉路口往东北约180米',\n",
       "  'poiweight': '0.123706',\n",
       "  'businessarea': '温泉'},\n",
       " {'id': 'B0FFLJUBM6',\n",
       "  'name': '浩锋拖车服务有限公司',\n",
       "  'type': '汽车服务;汽车服务相关;汽车服务相关',\n",
       "  'tel': [],\n",
       "  'direction': '西',\n",
       "  'distance': '464.566',\n",
       "  'location': '113.666989,23.643103',\n",
       "  'address': '温泉镇福泉路荔品汇方向上坡往前走400米',\n",
       "  'poiweight': '0.172207',\n",
       "  'businessarea': '温泉'},\n",
       " {'id': 'B0FFLJV8JY',\n",
       "  'name': '从化公安24小时自助办证区',\n",
       "  'type': '政府机构及社会团体;公检法机构;公安警察',\n",
       "  'tel': [],\n",
       "  'direction': '西',\n",
       "  'distance': '577.938',\n",
       "  'location': '113.665957,23.642598',\n",
       "  'address': [],\n",
       "  'poiweight': '0.266754',\n",
       "  'businessarea': '温泉'},\n",
       " {'id': 'B00140SSJ8',\n",
       "  'name': '其兴里',\n",
       "  'type': '地名地址信息;普通地名;村庄级地名',\n",
       "  'tel': [],\n",
       "  'direction': '东北',\n",
       "  'distance': '670.899',\n",
       "  'location': '113.674968,23.648817',\n",
       "  'address': '从化区',\n",
       "  'poiweight': '0.300883',\n",
       "  'businessarea': '温泉'},\n",
       " {'id': 'B00140SSJT',\n",
       "  'name': '卫东村',\n",
       "  'type': '地名地址信息;普通地名;村庄级地名',\n",
       "  'tel': [],\n",
       "  'direction': '东北',\n",
       "  'distance': '791.834',\n",
       "  'location': '113.677733,23.647946',\n",
       "  'address': '从化区',\n",
       "  'poiweight': '0.281402',\n",
       "  'businessarea': '温泉'},\n",
       " {'id': 'B0FFHI5E3D',\n",
       "  'name': '卫东立交',\n",
       "  'type': '地名地址信息;交通地名;立交桥',\n",
       "  'tel': [],\n",
       "  'direction': '西北',\n",
       "  'distance': '697.827',\n",
       "  'location': '113.665349,23.646438',\n",
       "  'address': '从化区',\n",
       "  'poiweight': '0.243363',\n",
       "  'businessarea': '温泉'},\n",
       " {'id': 'B0FFL3TNAX',\n",
       "  'name': '从化消防大队温泉站',\n",
       "  'type': '政府机构及社会团体;公检法机构;消防机关',\n",
       "  'tel': [],\n",
       "  'direction': '东北',\n",
       "  'distance': '716.362',\n",
       "  'location': '113.677249,23.647402',\n",
       "  'address': '温泉大道与三层街交叉口东北约100米',\n",
       "  'poiweight': '0.145199',\n",
       "  'businessarea': '温泉'},\n",
       " {'id': 'B0FFIAPQ5C',\n",
       "  'name': '荔品汇(建设中)',\n",
       "  'type': '商务住宅;商务住宅相关;商务住宅相关',\n",
       "  'tel': [],\n",
       "  'direction': '西',\n",
       "  'distance': '899.214',\n",
       "  'location': '113.662855,23.642072',\n",
       "  'address': 'Y526(福泉路)',\n",
       "  'poiweight': '0.163558',\n",
       "  'businessarea': '温泉'},\n",
       " {'id': 'B0FFGSLPVS',\n",
       "  'name': '温泉出口(G45大广高速南向)',\n",
       "  'type': '地名地址信息;交通地名;高速路出口',\n",
       "  'tel': [],\n",
       "  'direction': '西南',\n",
       "  'distance': '992.802',\n",
       "  'location': '113.664404,23.637570',\n",
       "  'address': '从化区',\n",
       "  'poiweight': '0.209425',\n",
       "  'businessarea': '温泉'},\n",
       " {'id': 'B0FFGSLOPD',\n",
       "  'name': '温泉收费站(G45大广高速入口)',\n",
       "  'type': '道路附属设施;收费站;收费站',\n",
       "  'tel': [],\n",
       "  'direction': '西南',\n",
       "  'distance': '840.769',\n",
       "  'location': '113.666065,23.637999',\n",
       "  'address': '从化区',\n",
       "  'poiweight': '0.186236',\n",
       "  'businessarea': '温泉'}]"
      ]
     },
     "execution_count": 43,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "r.json()['regeocode']['pois']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 59,
   "id": "7ade3b1e",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'suggestion': {'keywords': [], 'cities': []},\n",
       " 'count': '1',\n",
       " 'infocode': '10000',\n",
       " 'pois': [{'parent': [],\n",
       "   'address': '温泉镇卫东村105国道旁广州南方学院斜对面',\n",
       "   'distance': '2695',\n",
       "   'pname': '广东省',\n",
       "   'importance': [],\n",
       "   'biz_ext': {'cost': '51.00', 'rating': '4.1'},\n",
       "   'biz_type': [],\n",
       "   'cityname': '广州市',\n",
       "   'type': '体育休闲服务;体育休闲服务场所;体育休闲服务场所',\n",
       "   'photos': [{'title': [],\n",
       "     'url': 'http://store.is.autonavi.com/showpic/3ee2a7c09c8992d500acc30ff66db0b5'},\n",
       "    {'title': [],\n",
       "     'url': 'http://store.is.autonavi.com/showpic/1ef3c07c040d2ebd313f15e0a47b75e4'},\n",
       "    {'title': [],\n",
       "     'url': 'http://store.is.autonavi.com/showpic/5eca7989529851f02704189883cad3b2'}],\n",
       "   'typecode': '080000',\n",
       "   'shopinfo': '0',\n",
       "   'poiweight': [],\n",
       "   'childtype': [],\n",
       "   'adname': '从化区',\n",
       "   'name': '从化温泉竹园农庄(温泉镇店)',\n",
       "   'location': '113.672914,23.645264',\n",
       "   'tel': '13268333103;13650895671',\n",
       "   'shopid': [],\n",
       "   'id': 'B0FFIXZM0P'}],\n",
       " 'status': '1',\n",
       " 'info': 'OK'}"
      ]
     },
     "execution_count": 59,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 接口调用模块\n",
    "# 1. 调用requests模块（谷歌浏览器）\n",
    "import requests\n",
    "\n",
    "# 2.请求方法：Get\n",
    "\n",
    "# 3.url地址：\n",
    "poi_url = \"https://restapi.amap.com/v3/place/text?parameters\"\n",
    "\n",
    "# 4.准备参数，用于交换数据[payload]\n",
    "payload = {\n",
    "    'key' : 'a100a0fe3fbe830ec11430470e8809b0',\n",
    "    'keywords':'从化温泉竹园农庄(温泉镇店)',\n",
    "}\n",
    "\n",
    "# 5. 发起请求 酬载\n",
    "# params --> 请求的参数\n",
    "r = requests.get(url=poi_url,params=payload)\n",
    "r.json()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 58,
   "id": "90196968",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>parent</th>\n",
       "      <th>address</th>\n",
       "      <th>distance</th>\n",
       "      <th>pname</th>\n",
       "      <th>importance</th>\n",
       "      <th>biz_type</th>\n",
       "      <th>cityname</th>\n",
       "      <th>type</th>\n",
       "      <th>photos</th>\n",
       "      <th>typecode</th>\n",
       "      <th>...</th>\n",
       "      <th>poiweight</th>\n",
       "      <th>childtype</th>\n",
       "      <th>adname</th>\n",
       "      <th>name</th>\n",
       "      <th>location</th>\n",
       "      <th>tel</th>\n",
       "      <th>shopid</th>\n",
       "      <th>id</th>\n",
       "      <th>biz_ext.cost</th>\n",
       "      <th>biz_ext.rating</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>[]</td>\n",
       "      <td>温泉镇卫东村105国道旁广州南方学院斜对面</td>\n",
       "      <td>2695</td>\n",
       "      <td>广东省</td>\n",
       "      <td>[]</td>\n",
       "      <td>[]</td>\n",
       "      <td>广州市</td>\n",
       "      <td>体育休闲服务;体育休闲服务场所;体育休闲服务场所</td>\n",
       "      <td>[{'title': [], 'url': 'http://store.is.autonav...</td>\n",
       "      <td>080000</td>\n",
       "      <td>...</td>\n",
       "      <td>[]</td>\n",
       "      <td>[]</td>\n",
       "      <td>从化区</td>\n",
       "      <td>从化温泉竹园农庄(温泉镇店)</td>\n",
       "      <td>113.672914,23.645264</td>\n",
       "      <td>13268333103;13650895671</td>\n",
       "      <td>[]</td>\n",
       "      <td>B0FFIXZM0P</td>\n",
       "      <td>51.00</td>\n",
       "      <td>4.1</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>1 rows × 21 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "  parent                address distance pname importance biz_type cityname  \\\n",
       "0     []  温泉镇卫东村105国道旁广州南方学院斜对面     2695   广东省         []       []      广州市   \n",
       "\n",
       "                       type  \\\n",
       "0  体育休闲服务;体育休闲服务场所;体育休闲服务场所   \n",
       "\n",
       "                                              photos typecode  ... poiweight  \\\n",
       "0  [{'title': [], 'url': 'http://store.is.autonav...   080000  ...        []   \n",
       "\n",
       "  childtype adname            name              location  \\\n",
       "0        []    从化区  从化温泉竹园农庄(温泉镇店)  113.672914,23.645264   \n",
       "\n",
       "                       tel shopid          id biz_ext.cost biz_ext.rating  \n",
       "0  13268333103;13650895671     []  B0FFIXZM0P        51.00            4.1  \n",
       "\n",
       "[1 rows x 21 columns]"
      ]
     },
     "execution_count": 58,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import pandas as pd\n",
    "pd.json_normalize(r.json()['pois'])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 62,
   "id": "a4524d98",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'status': '1',\n",
       " 'info': 'OK',\n",
       " 'infocode': '10000',\n",
       " 'pois': [{'name': '盛丰汽车修理厂',\n",
       "   'id': 'B0FFG9IUQS',\n",
       "   'location': '113.634189,23.616979',\n",
       "   'type': '汽车维修;汽车维修;汽车维修',\n",
       "   'typecode': '030000',\n",
       "   'pname': '广东省',\n",
       "   'cityname': '广州市',\n",
       "   'adname': '从化区',\n",
       "   'address': '温泉大道温泉镇政府东侧约120米',\n",
       "   'pcode': '440000',\n",
       "   'citycode': '020',\n",
       "   'adcode': '440117'},\n",
       "  {'name': '港龙汽车维修部',\n",
       "   'id': 'B0FFJPUVMV',\n",
       "   'location': '113.666648,23.603585',\n",
       "   'type': '汽车维修;汽车维修;汽车维修',\n",
       "   'typecode': '030000',\n",
       "   'pname': '广东省',\n",
       "   'cityname': '广州市',\n",
       "   'adname': '从化区',\n",
       "   'address': '温泉镇龙岗虚龙泉路165号',\n",
       "   'pcode': '440000',\n",
       "   'citycode': '020',\n",
       "   'adcode': '440117'},\n",
       "  {'name': '流动补胎维修',\n",
       "   'id': 'B0FFKL4FYB',\n",
       "   'location': '113.694620,23.682858',\n",
       "   'type': '汽车维修;汽车维修;汽车维修',\n",
       "   'typecode': '030000',\n",
       "   'pname': '广东省',\n",
       "   'cityname': '广州市',\n",
       "   'adname': '从化区',\n",
       "   'address': '良口镇高沙村74号',\n",
       "   'pcode': '440000',\n",
       "   'citycode': '020',\n",
       "   'adcode': '440117'},\n",
       "  {'name': '忠诚轮胎店(流动补胎24小时补胎维修抢修服务)',\n",
       "   'id': 'B0FFMDZ3OE',\n",
       "   'location': '113.631574,23.613836',\n",
       "   'type': '汽车维修;汽车维修;汽车维修',\n",
       "   'typecode': '030000',\n",
       "   'pname': '广东省',\n",
       "   'cityname': '广州市',\n",
       "   'adname': '从化区',\n",
       "   'address': '温泉镇温泉大道361号',\n",
       "   'pcode': '440000',\n",
       "   'citycode': '020',\n",
       "   'adcode': '440117'},\n",
       "  {'name': '友邦汽车修配厂',\n",
       "   'id': 'B0HA3X2S9C',\n",
       "   'location': '113.710923,23.618918',\n",
       "   'type': '汽车维修;汽车维修;汽车维修',\n",
       "   'typecode': '030000',\n",
       "   'pname': '广东省',\n",
       "   'cityname': '广州市',\n",
       "   'adname': '从化区',\n",
       "   'address': '温泉镇中田村石四队18号',\n",
       "   'pcode': '440000',\n",
       "   'citycode': '020',\n",
       "   'adcode': '440117'},\n",
       "  {'name': '兴配汽车维修店',\n",
       "   'id': 'B0FFKCEIV4',\n",
       "   'location': '113.667301,23.602572',\n",
       "   'type': '汽车维修;汽车维修;汽车维修',\n",
       "   'typecode': '030000',\n",
       "   'pname': '广东省',\n",
       "   'cityname': '广州市',\n",
       "   'adname': '从化区',\n",
       "   'address': '龙泉路旁',\n",
       "   'pcode': '440000',\n",
       "   'citycode': '020',\n",
       "   'adcode': '440117'},\n",
       "  {'name': '广州市穗联汽车养护中心',\n",
       "   'id': 'B0HDGUOPR3',\n",
       "   'location': '113.652673,23.577347',\n",
       "   'type': '汽车维修;汽车维修;汽车维修',\n",
       "   'typecode': '030000',\n",
       "   'pname': '广东省',\n",
       "   'cityname': '广州市',\n",
       "   'adname': '从化区',\n",
       "   'address': '温泉镇石海工业大道70号',\n",
       "   'pcode': '440000',\n",
       "   'citycode': '020',\n",
       "   'adcode': '440117'},\n",
       "  {'name': '从化服务区汽修',\n",
       "   'id': 'B0G3L5IGKU',\n",
       "   'location': '113.646491,23.610851',\n",
       "   'type': '汽车维修;汽车维修;汽车维修',\n",
       "   'typecode': '030000',\n",
       "   'pname': '广东省',\n",
       "   'cityname': '广州市',\n",
       "   'adname': '从化区',\n",
       "   'address': 'G45大广高速与从化服务区交叉口西440米',\n",
       "   'pcode': '440000',\n",
       "   'citycode': '020',\n",
       "   'adcode': '440117'},\n",
       "  {'name': '从化服务区加水',\n",
       "   'id': 'B0G3L5INVH',\n",
       "   'location': '113.646516,23.610877',\n",
       "   'type': '汽车维修;汽车维修;汽车维修',\n",
       "   'typecode': '030000',\n",
       "   'pname': '广东省',\n",
       "   'cityname': '广州市',\n",
       "   'adname': '从化区',\n",
       "   'address': 'G45大广高速与从化服务区交叉口西440米',\n",
       "   'pcode': '440000',\n",
       "   'citycode': '020',\n",
       "   'adcode': '440117'},\n",
       "  {'name': '从化服务区汽修',\n",
       "   'id': 'B0G39LQ0LI',\n",
       "   'location': '113.647932,23.609740',\n",
       "   'type': '汽车维修;汽车维修;汽车维修',\n",
       "   'typecode': '030000',\n",
       "   'pname': '广东省',\n",
       "   'cityname': '广州市',\n",
       "   'adname': '从化区',\n",
       "   'address': 'G45大广高速与从化服务区交叉口西南380米',\n",
       "   'pcode': '440000',\n",
       "   'citycode': '020',\n",
       "   'adcode': '440117'}],\n",
       " 'count': '10'}"
      ]
     },
     "execution_count": 62,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 接口调用模块\n",
    "# 1. 调用requests模块（谷歌浏览器）\n",
    "import requests\n",
    "\n",
    "# 2.请求方法：Get\n",
    "\n",
    "# 3.url地址：\n",
    "poi_url = \"https://restapi.amap.com/v5/place/text?parameters\"\n",
    "\n",
    "# 4.准备参数，用于交换数据[payload]\n",
    "payload = {\n",
    "    'key' : 'a100a0fe3fbe830ec11430470e8809b0',\n",
    "    'location' : '113.671505,23.643685',\n",
    "    'keywords': '汽车'\n",
    "\n",
    "}\n",
    "\n",
    "# 5. 发起请求 酬载\n",
    "# params --> 请求的参数\n",
    "r = requests.get(url=poi_url,params=payload)\n",
    "r.json()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "587ec963",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "aab73aa9",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "91b57601",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "e927de37",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "03e0fb77",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "879d3db1",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.8"
  },
  "toc": {
   "base_numbering": "null",
   "nav_menu": {},
   "number_sections": false,
   "sideBar": true,
   "skip_h1_title": true,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {
    "height": "calc(100% - 180px)",
    "left": "10px",
    "top": "150px",
    "width": "165px"
   },
   "toc_section_display": true,
   "toc_window_display": true
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
